﻿
namespace TFSChangeLog.ViewModel
{
    using System;
    using System.ComponentModel;
    using Microsoft.TeamFoundation.VersionControl.Client;

    /// <summary>Summary description for <see cref="ToChangeSetViewModel"/> class.</summary>
    public class ToChangeSetViewModel : INotifyPropertyChanged
    {
        /// <summary>Summary description for class level field of type <c>bool</c>.</summary>
        private bool _isSelected;

        /// <summary>Summary description for class level field of type <c>Microsoft.TeamFoundation.VersionControl.Client.Changeset</c>.</summary>
        private readonly Changeset _toChangeset;

        #region Constructors

        /// <summary>Initializes a new instance of the <see cref="ToChangeSetViewModel"/> class.</summary>
        /// <param name="changeset">TODO: Summary description for <c>changeset</c> parameter of type <c>Microsoft.TeamFoundation.VersionControl.Client.Changeset</c>.</param>
        public ToChangeSetViewModel(Changeset changeset)
        {
            this._toChangeset = changeset;
            this._isSelected = false;
        }

        #endregion

        #region IsSelected

        /// <summary>Gets or sets a value indicating whether (TODO: Fix the documentation here) :: Gets/sets whether the ChangeListItem 
        /// in the ComboBox is selected.</summary>
        public bool IsSelected
        {
            get
            {
                return this._isSelected;
            }

            set
            {
                if (value != this._isSelected)
                {
                    this._isSelected = value;
                    this.OnPropertyChanged("IsSelected");
                }
            }
        }

        #endregion // IsSelected

        #region ToChangeSetID
        /// <summary>Gets the value for ToChangesetID.</summary>
        public int ToChangesetID
        {
            get { return this._toChangeset.ChangesetId; }
        }
        #endregion //ToChangeSetID

        #region ToChangeSet

        /// <summary>Gets the value for ToChangeSet.</summary>
        public Changeset ToChangeSet
        {
            get { return this._toChangeset; }
        }

        #endregion // ToChangeSet

        #region INotifyPropertyChanged Members

        /// <summary>Summary description for <c>PropertyChanged</c> event.</summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>Summary description for <c>ToChangeSetViewModel</c> method.</summary>
        /// <param name="propertyName">TODO: Summary description for <c>propertyName</c> parameter of type <c>string</c>.</param>
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
                }
        }

        #endregion // INotifyPropertyChanged Members
    }
}
